﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Facade
{
    class EncryptFacade
    {
        private FileReader reader;
        private CipherMachine cipher;
        private FileWriter writer;

        public EncryptFacade()
        {
            reader = new FileReader();
            cipher = new CipherMachine();
            writer = new FileWriter();
        }

        public void FileEncrypt(string fileNameSource, string fileNameTarget)
        {
            Console.WriteLine("=== 开始文件加密流程 ===");

            // 读取文件
            string plainText = reader.read(fileNameSource);

            // 加密数据
            string encryptText = cipher.encrypt(plainText);

            // 写入文件
            writer.write(encryptText, fileNameTarget);

            Console.WriteLine("=== 文件加密完成 ===");
        }
    }
}